#include "GlobalValuesDefine.h"

uint8_t g_ForbidMotorFrame; //0-continue send,1-get ask an then send

//使能、模式、速度、扭矩、故障
uint8_t g_ControlMode = 0; //control mode
uint8_t g_RunningEnable = 0; //running enable
int16_t g_MotorMcuRunSpeed=0; //MCU当前速度
int16_t g_MotorReadSpeed=0; //实际A4964读取速度
int16_t g_MotorTargetSpeed=0; //目标速度
uint8_t g_MotorTorque = 0; //torque,0-32
uint8_t g_ErrorLevel = 0;
uint8_t g_ErrorCode = 0;

//功率温度
int16_t g_ActualPower = 0; //功率
int16_t g_ActualTotalEnergy = 0; //能耗
int16_t g_WindingTemperature = 25; //motor winding temperature
int16_t g_InverterTemperature = 25; //mtcl inverter temperature
int16_t g_MtclChipTemperature; //mtcl chip a4964 temperature

//电流电压
uint16_t g_DcVoltage = 0;
uint8_t g_DcCurrent = 0;
uint16_t g_AcVoltage = 0;
uint8_t g_AcCurrent = 0;
uint16_t g_McuInputVoltage=0; //MCU Voltage


//version
uint8_t g_Version_Year = 0x18;
uint8_t g_Version_Month = 0x07;
uint8_t g_Version_Day = 0x13;
uint8_t g_Version_Hour = 0x14;
uint8_t g_Version_Minute = 0x18;



/******************************************/
/*************** A4964参数 ****************/
/******************************************/
//A4964寄存器0-28，共29个寄存器值
uint16_t g_A4964_RegisterValues[29] = {
    0x00B3,0x0001,0x0029,0x0001,0x0001,0x0001,0x00FE,0x007F,0x007F,0x0001,0x0001,0x0020,0x0020,0x0007,0x0070,0x0042,0x0038,0x004E,0x0086,0x0060,0x0072,0x006A,0x0040,0x000E,0x00FE,0x0389,0x0001,
    0x0004,0x0200
}; //register0-26,and 28